{% extends "admin/base_site.html" %}
{% load i18n admin_modify adminmedia %}
{% load url from future %}

{% block extrahead %}{{ block.super }}
{% url 'admin:jsi18n' as jsi18nurl %}
<script type="text/javascript" src="{{ jsi18nurl|default:"../../../jsi18n/" }}"></script>
{{ media }}
{% endblock %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}

{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}

{% block bodyclass %}Добавление новости{% endblock %}

{% block breadcrumbs %}{% if not is_popup %}
<div class="breadcrumbs">
     <a href="../../../">{% trans "Home" %}</a> &rsaquo;
     <a href="../../">{{ 'news'|capfirst|escape }}</a> &rsaquo;
    <a href="../">{{ 'records'|capfirst|escape }}</a> &rsaquo;
</div>
{% endif %}{% endblock %}

{% block content %}
<div id="content-main">
<h1>Изменить/Создать новость</h1>
<form action="" method="POST" id="news-record-edit-form">
    {% csrf_token %}
    <div id="news-record-edit-form-tabs">
        <ul>
            <li><a href="#tab-1">Основные параметры</a></li>
            <li><a href="#tab-2">Дополнительные параметры</a></li>
        </ul>
        <div id="tab-1">
            <fieldset class="module aligned">
                {{ form.errors }}
                <div class="form-row title" style="overflow: hidden;">
                    {{ form.title.errors }}
                    {{ form.category.errors }}
                    <div style="float: left;">
                        <label for="id_title" class="required">Заголовок:</label>
                        {{ form.title }}
                    </div>
                    <div style="float: left; margin-left: 30px;">
                        <label for="id_category">Категория:</label>
                        {{ form.category }}
                    </div>
                </div>
                <div class="form-row title" style="overflow: hidden;">
                    {{ form.publish_date.errors }}
                    {{ form.author.errors }}
                    <div style="float: left;">
                        <label for="id_publish_date">Дата публикации:</label>
                        {{ form.publish_date }}
                        <script type="text/javascript">
                            $("#id_publish_date").datetimepicker({
				showSecond: true,
                                dateFormat: 'dd.mm.yy',
                                timeFormat: 'hh:mm:ss'
                            });
                        </script>
                    </div>
                    <div style="float: left; margin-left: 30px;">
                        <label for="id_author" class="required">Автор:</label>
                        {{ form.author }}
                    </div>
                </div>
                <div class="form-row title">
                    {{ form.story.errors }}
                    <label for="id_story" class="required">Текст:</label>
                    {{ form.story }}
                </div>
                <div class="form-row title">
                    {{ form.status.errors }}
                    <label for="id_status" class="required">Статус:</label>
                    {{ form.status }}
                </div>
            </fieldset>
        </div>
        <div id="tab-2">
            <fieldset class="module aligned">
                <div class="form-row title">
                    {{ form.url.errors }}
                    <label for="id_url">ЧПУ ссылка (без html):</label>
                    {{ form.url }}
                </div>
                <div class="form-row title">
                    {{ form.meta_description.errors }}
                    <label for="id_meta_description">Meta описание:</label>
                    {{ form.meta_description }}
                </div>
                <div class="form-row title">
                    {{ form.meta_keywords.errors }}
                    <label for="id_meta_keywords">Meta ключевые слова:</label>
                    {{ form.meta_keywords }}
                </div>
                {{ form.views }}
                {{ form.rating }}
            </fieldset>
        </div>
    </div>
    <div class="submit-row">
        <p class="deletelink-box"><a href="delete/" class="deletelink">Удалить</a></p>
        <input type="submit" value="Сохранить/Создать">
    </div>
</form>
</div>

<script type="text/javascript">
    $("#news-record-edit-form-tabs").tabs();
    {% if record_pk %}
        imagesManager.recordID = {{ record_pk }};
    {% endif %}
</script>

    

{% endblock %}
